package com.hmall.user.config;


import com.hmall.user.Intercepter.Intercepter;
import org.apache.ibatis.plugin.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {
   @Autowired
   Intercepter interceptor;
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        registry.addInterceptor(interceptor)
                .addPathPatterns("/**") //拦截请求路径   /**所有请求
                .excludePathPatterns("/user/login", "/user/register");//排除的请求路径
    }

}
